﻿using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System.Reflection;

namespace WenAntdUI.Extensions
{
    public static class ControlServiceHelpExtension
    {
        public static IServiceCollection AddControlServices(this IServiceCollection services, Assembly assembly)
        {
            var types = assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Control)));
            foreach (var item in types)
            {
                services.TryAddSingleton(item);
            }
            return services;
        }
    }
}
